import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(Element)

Vue.prototype.$ELEMENT = {
    //项目中所有拥有 size 属性的组件的默认尺寸 (medium / small / mini)
    size: 'mini',
    //日期选择模板
    pickerOptions: {
        shortcuts: [
            {
                text: "最近一周",
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                    picker.$emit("pick", [start, end]);
                }
            },
            {
                text: "最近一个月",
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                    picker.$emit("pick", [start, end]);
                }
            },
            {
                text: "最近三个月",
                onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                    picker.$emit("pick", [start, end]);
                }
            }
        ]
    },
    //级联选择器
    cascaderProps: {
        value: 'value', //保存的值
        label: 'label', //显示的值
        children: 'children',//指定嵌套
        expandTrigger: 'hover',//hover触发
        checkStrictly: true,//是否严格的遵守父子节点不互相关联
        emitPath: false, //在选中节点改变时，是否返回由该节点所在的各级菜单的值所组成的数组，若设置 false，则只返回该节点的值
    },
};
